﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Web.Profile;

namespace WebSite
{
    public class info
    {
        // Methods
        public static string info1(string str, string shopid)
        {
            string sql = "Select [" + shopid + "] From DB_Shopconfig";
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            if (table.Rows.Count > 0)
            {
                str = table.Rows[0][0].ToString();
                if (((shopid.ToString() == "shopqq") || (shopid.ToString() == "shopmsn")) || ((shopid.ToString() == "shopaliwan") || (shopid.ToString() == "shopskype")))
                {
                    str = table.Rows[0][0].ToString().Split(new char[] { '|' })[0];
                }
            }
            if (str.Trim().ToString() == "")
            {
                str = "";
            }
            return str.Trim();
        }

        public static string languages(string str)
        {
            string sql = "select * from DB_Language where visible=1 and istrue=1 order by languageid asc";
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            if (table.Rows.Count != 0)
            {
                str = table.Rows[0]["languageid"].ToString();
            }
            if (str.Trim().ToString() == "2")
            {
                str = "1";
            }
            if (str.Trim().ToString() == "")
            {
                str = "1";
            }
            return str.Trim();
        }

        public static string model(string str)
        {
            string sql = "select top 1 * from DB_Model where visible=1 and isright=1";
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            if (table.Rows.Count != 0)
            {
                str = table.Rows[0]["modelid"].ToString();
            }
            if (str.Trim().ToString() == "")
            {
                str = "1";
            }
            return str.Trim();
        }

        public static string rank(string str, string memberid, string proid)
        {
            string sql = "select DB_Memberprice.*,DB_Member.memberid from DB_Memberprice,DB_Member where DB_Memberprice.rankid=DB_Member.rankid and DB_Member.memberid=" + memberid + " and DB_Memberprice.productid=" + proid + "";
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            if (table.Rows.Count != 0)
            {
                str = table.Rows[0]["price"].ToString();
            }
            if (str.Trim().ToString() == "")
            {
                str = "0";
            }
            return str.Trim();
        }

        public static string ranka(string str, string proid)
        {
            string sql = "select * from DB_Shoppro where proid=" + proid + "";
            DataTable table = new DataTable();
            table = SQLAccess.GreatDs(sql).Tables[0];
            if (table.Rows.Count != 0)
            {
                str = table.Rows[0]["proprice1"].ToString();
            }
            if (str.Trim().ToString() == "")
            {
                str = "0";
            }
            return str.Trim();
        }

    }
}